# encoding=utf8
from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager

from shop import create_app
from shop.model import db
from shop.views import api

app = create_app()

db.init_app(app=app)
api.init_app(app=app)

# 添加模型文件启动
manager = Manager(app=app)
migrate = Migrate(app=app, db=db)
manager.add_command('db', MigrateCommand)

if __name__ == '__main__':
    app.debug = True
    # app.run(host='0.0.0.0',port=os.getenv("FLASK_PORT"))
    manager.run()
